@extends('master')
@section('title', $categ->nombre)
@section('content')
{{--------------------------------- Lista de Objetos --------------------------------}}
<div id="infinitescroll" class="container-fluid">
    <div class="row">
        <div class="col-md-12">
            <h3>{{ $categ->nombre }}</h3>
        </div>
    </div>
    <div class="row caja">
        @foreach($objetos as $objeto)
            <div class="col-md-3 col-sm-6">
                    @if( $image = $objeto->getFirstImage() )
                        <a href="{{ URL::route('objeto', ['slug' => $objeto->slug, 'id' => $objeto->id]) }}">
                            <img class="lazy img-full" src="{{ $src = URL::to($image->img->url('obj_mini')) }}" data-original="{{ $src }}" alt="{{ $image->title }}"/>
                        </a>
                    @endif
                    <ul class="list-unstyled">
                        <li><a href="{{ URL::route('objeto', ['slug' => $objeto->slug, 'id' => $objeto->id]) }}">{{ $objeto->nombre }}</a></li>
                        <li><em><a href="{{ $objeto->link }}">{{ $objeto->link_name }}</a></em></li>
                    </ul>
            </div>
        @endforeach
    </div> {{-- .row --}}
    {{  $objetos->links() }}
</div> {{-- .container-fluid --}}
@stop

@section('scripts')
    {{ HTML::script('assets/js/infinitescroll.js') }}
    <script>
        $('#infinitescroll').infinitescroll({
            navSelector     : ".pager",
            nextSelector    : ".pager a:last",
            itemSelector    : ".caja",
            debug           : false,
            dataType        : 'html',
            maxPage: {{ $lastPage }},
            path: function(index) {
                return "?page=" + index;
            },
            loading: {
                finishedMsg: "",
                img: "{{ URL::to('assets/img/preloader.gif') }}",
                msgText: ""
            }
        });
    </script>
@stop